switch case in Java
What is the default switch case?
594
27-Aug-2019
Shrikant Mishra
27-Aug-2019Ans: In a switch statement, the default case is executed when no other switch condition matches. The default case is an optional case. It can be declared only once all other switch cases have been coded.
In the below example, when the score is not 1 or 2, the default case is used.